<template>
<view class="signature-section">
  <text class="title">{{ title }}</text>

  <!-- 签名文件按钮 -->
  <view class="file-input">
    <button @click="chooseFile">📎 点击上传签名文件</button>
  </view>

  <!-- 签名预览区域 -->
  <view class="signature-area">
    <image 
      v-if="signatureUrl"
      :src="signatureUrl"
      class="signature-preview"
    ></image>
    
    <text v-else class="placeholder">请上传签名文件</text>
  </view>

  <!-- 日期编辑器 -->
  <view class="date-editors">
    <view class="date-editor">
      <text>年：</text>
      <input 
        v-model="year"
        type="number"
        placeholder="2024"
        style="width: 60px;"
      ></input>
    </view>
    
    <view class="date-editor">
      <text>月：</text>
      <input 
        v-model="month"
        type="number"
        placeholder="01"
        style="width: 60px;"
      ></input>
    </view>
    
    <view class="date-editor">
      <text>日：</text>
      <input 
        v-model="day"
        type="number"
        placeholder="01"
        style="width: 60px;"
      ></input>
    </view>
  </view>
</view>
</template>

<script>
export default {
  props: {
    title: String,
    isElectronic: Boolean
  },
  
  data() {
    return {
      signatureUrl: '',
      year: '',
      month: '',
      day: ''
    };
  },
  
  methods: {
    chooseFile() {
      // 模拟文件选择
      console.log("选择签名文件");
      
      // 模拟上传成功
      setTimeout(() => {
        this.signatureUrl = 'https://example.com/signature.png';
      }, 500);
    }
  }
};
</script>